#include "cocowindow.h"

#include "qt\CCGLWidget.h"
#include "CCDirector.h"
#include "cocos2d.h"
using namespace cocos2d;

CocoWindow::CocoWindow(QWidget * parent ) :QWidget(parent)
{
    m_canDrag = false;
    m_pos.setX(50);
    m_pos.setY(50);
}



void CocoWindow::mouseMoveEvent(QMouseEvent *event)
{
//    if (m_canDrag)
//    {
//        m_pos = event->pos();
//        m_pos.setX(m_pos.x()+m_pressPoint.x());
//        m_pos.setY(m_pos.y()+ m_pressPoint.y());
//        //m_pStatus->showMessage(QString("x:%1,y:%2").arg(m_pos.x()).arg(m_pos.y()));
//        update();
//    }
}

void CocoWindow::mousePressEvent(QMouseEvent * event)
{
//    QPoint p = event->pos();
//    QRect rect(m_pos.x(), m_pos.y() , 50,50);
//    if (rect.contains(p))
//    {
//        m_canDrag = true;
//        m_pressPoint = QPoint(m_pos.x() - p.x() , m_pos.y() - p.y());
//    }else
//        m_canDrag = false;
}

void CocoWindow::mouseReleaseEvent(QMouseEvent *)
{
//    m_canDrag = false;
}

void CocoWindow::paintEvent(QPaintEvent *event)
{
// 	CCEGLView * eglView = CCDirector::sharedDirector()->getOpenGLView();
// 	GLWidget * glwidget = eglView->glWidget();

//	QPainter painter(this);
//	painter.drawRect(m_pos.x(), m_pos.y() , 50,50);


}
